#ifndef __VSFIP_TCP_FORWARD_H_INCLUDED__
#define __VSFIP_TCP_FORWARD_H_INCLUDED__

struct vsfip_forward_conn_t
{
	struct vsfip_socket_t *so;
	struct vsfip_socket_t *fso;
	struct vsfip_forward_work_t
	{
		struct vsfip_socket_t *rx_so;
		struct vsfip_socket_t *tx_so;

		uint32_t *exit;
		struct vsfsm_sem_t *sem;

		struct vsfsm_pt_t pt;
		struct vsfsm_t sm;
		struct vsfsm_pt_t caller_pt;
		struct vsfip_buffer_t *curbuf;
	} tx, rx;
	struct vsfsm_sem_t sem;
	uint32_t exit;
	struct vsflist_t list;
};

struct vsfip_tcp_forward_t
{
	// public
	struct vsfip_sockaddr_t sockaddr;

	// private
	struct
	{
		struct vsfip_socket_t *so;
		struct vsfsm_pt_t pt;
		struct vsfsm_t sm;
		struct vsfsm_pt_t caller_pt;
	} listener;
	struct vsfip_forward_conn_t *cur_conn;
	struct vsflist_t conn;
};

vsf_err_t vsfip_tcp_forward_start(struct vsfip_tcp_forward_t *forwarder);

#endif		// __VSFIP_TCP_FORWARD_H_INCLUDED__
